package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 *
 */
public class PWDemo {
    public static void main(String[] args) throws IOException {
        //最常用写入字符串的方式：
        /*
        PrintWriter pw=new PrintWriter("pw.txt");
        pw.println("啊？");
        pw.println("前面都是屁话吗");
        pw.close();
        */



        FileOutputStream fos=new FileOutputStream("fos.txt");//低级流
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);//转换流
        BufferedWriter bw=new BufferedWriter(osw);//给转换流上个BUFF
        PrintWriter pw=new PrintWriter(bw);
        pw.println("好困呐");
        pw.println("好想睡觉");
        pw.close();
        System.out.println("完毕");


    }
}
